Linux安装Nginx步骤之后续,带stream模块 | 您所在的位置:网站首页 › linux nginx安装启动 › Linux安装Nginx步骤之后续,带stream模块 |
0.安装nginx
linux安装nginx 1.检查nginx是否安装成功 cd /usr/local/nginx/sbin ./nginx -t显示 :nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful 则启动成功 -------------------------------------------------------------------------------------- 报错:centos No rule to make target `build', needed by `default 安装前置库: [root@cqakserver local]# yum install -y gcc pcre pcre-devel openssl openssl-devel gd gd-devel 重新configure make -------------------------------------------------------------------------------------- 2.配置软链接 sudo ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx就可以不用路径直接输入nginx启动。 3.安装stream模块remote tcp负载需要用,如果已经安装过stream则不用安装 (1)bash ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-stream --conf-path=/usr/local/nginx/conf/nginx.conf make (注意:此处只make,不要make install,否则线上配置会被清除,编译参数需要和之前的一样) (2)mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak (3)cp -rfp ./objs/nginx /usr/local/nginx/sbin (4)nginx -t 检查是否有报错 (5)在nginx.conf中添加: # tcp层转发的配置文件夹 include /usr/local/nginx/tcp.d/*.conf; (6)在tcp.d新建remote.conf stream{ upstream remote { server 192.168.1.70:8091; server 192.168.1.70:8092; } server { listen 18092; proxy_pass remote; } }(7)重新加载 nginx -s reload |
CopyRight 2018-2019 实验室设备网 版权所有 |